package com.cfpl.admin_service.mapper;

import com.cfpl.admin_service.VO.DueRecord;
import com.cfpl.project_common.pojo.Fertilizer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cfpl.project_common.pojo.FertilizerAcquireRecord;
import com.cfpl.project_common.pojo.FertilizerUsageRecords;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author 14720
* @description 针对表【fertilizer(肥料信息表)】的数据库操作Mapper
* @createDate 2023-10-17 14:29:56
* @Entity com.cfpl.project_common.pojo.Fertilizer
*/
@Mapper
public interface FertilizerMapper extends BaseMapper<Fertilizer> {

    /**
     * 删除肥料信息
     * @param fertilizerIds 肥料编号集合
     */
    void removeFertilizer(@Param("fertilizerIds") List<Long> fertilizerIds);

    /**
     * 添加领取肥料记录
     * @param fertilizerAcquireRecord 记录信息
     */
    void addAcquireFertilizerRecord(@Param("record")FertilizerAcquireRecord fertilizerAcquireRecord);

    /**
     * 扣减库存
     * @param fertilizerId 肥料编号
     * @param getStock 扣减库存量
     */
    boolean deductFertilizerStock(@Param("fertilizerId") Long fertilizerId,@Param("getStock") int getStock);

    /**
     * 添加肥料使用记录
     * @param fertilizerUsageRecords 记录对象
     */
    void insertFertilizerUsageRecord(@Param("fertilizerUsageRecords") FertilizerUsageRecords fertilizerUsageRecords);

    /**
     * 查询肥料即将到期的肥料施用记录
     */
    List<DueRecord> queryDueFertilizerRecord(@Param("interval") Integer interval);
}




